package com.micro.turtle.runner;

import cn.hutool.core.collection.CollectionUtil;
import com.micro.turtle.anon.CmdRunner;
import com.micro.turtle.constant.Cmd;
import com.micro.turtle.util.Log;
import java.util.Arrays;
import java.util.List;

/**
 * HelpRunner
 *
 * @author jason.lv
 * @since 2022/1/20 16:23
 */
@CmdRunner
public class HelpRunner extends Runner {

    public HelpRunner() {
        super(Cmd.HELP);
    }


    @Override
    void exec() {
        print(Arrays.asList(Cmd.values()));
    }

    public static void print(List<Cmd> cmds) {
        if (CollectionUtil.isEmpty(cmds)) {
            Log.info("Cmd >>>>> has no commands");
            return;
        }
        for (Cmd cmd : cmds) {
            Log.info("Cmd >>>>> %s: %s", cmd.getCmd(), cmd.getDesc());
        }
    }
}
